<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>I2C Interface</title>
<title>CMSIS-Driver: I2C Interface</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="cmsis.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="printComponentTabs.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 46px;">
  <td id="projectlogo"><img alt="Logo" src="CMSIS_Logo_Final.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">CMSIS-Driver
   &#160;<span id="projectnumber">Version 2.7.1</span>
   </div>
   <div id="projectbrief">Peripheral Interface for Middleware and Application Code</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<div id="CMSISnav" class="tabs1">
    <ul class="tablist">
      <script type="text/javascript">
		<!--
		writeComponentTabs.call(this);
		//-->
      </script>
	  </ul>
</div>
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Usage&#160;and&#160;Description</span></a></li>
      <li><a href="modules.html"><span>Reference</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__i2c__interface__gr.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#groups">Content</a> &#124;
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">I2C Interface</div>  </div>
</div><!--header-->
<div class="contents">

<p>Driver API for I2C Bus Peripheral (Driver_I2C.h)  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="groups"></a>
Content</h2></td></tr>
<tr class="memitem:group__I2C__events"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__I2C__events.html">I2C Events</a></td></tr>
<tr class="memdesc:group__I2C__events"><td class="mdescLeft">&#160;</td><td class="mdescRight">The I2C driver generates call back events that are notified via the function <a class="el" href="group__i2c__interface__gr.html#gad4f93d2895794b416dc8d8e9de91c05e">ARM_I2C_SignalEvent</a>. <br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__i2c__control__gr"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__control__gr.html">I2C Control Codes</a></td></tr>
<tr class="memdesc:group__i2c__control__gr"><td class="mdescLeft">&#160;</td><td class="mdescRight">Many parameters of the I2C driver are configured using the <a class="el" href="group__i2c__interface__gr.html#ga828f5fa289d065675ef78a9a73d129dc">ARM_I2C_Control</a> function. <br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__i2c__address__flags"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__address__flags.html">I2C Address Flags</a></td></tr>
<tr class="memdesc:group__i2c__address__flags"><td class="mdescLeft">&#160;</td><td class="mdescRight">Specify address flags. <br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:structARM__DRIVER__I2C"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#structARM__DRIVER__I2C">ARM_DRIVER_I2C</a></td></tr>
<tr class="memdesc:structARM__DRIVER__I2C"><td class="mdescLeft">&#160;</td><td class="mdescRight">Access structure of the I2C Driver.  <a href="group__i2c__interface__gr.html#structARM__DRIVER__I2C">More...</a><br/></td></tr>
<tr class="separator:structARM__DRIVER__I2C"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:structARM__I2C__CAPABILITIES"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#structARM__I2C__CAPABILITIES">ARM_I2C_CAPABILITIES</a></td></tr>
<tr class="memdesc:structARM__I2C__CAPABILITIES"><td class="mdescLeft">&#160;</td><td class="mdescRight">I2C Driver Capabilities.  <a href="group__i2c__interface__gr.html#structARM__I2C__CAPABILITIES">More...</a><br/></td></tr>
<tr class="separator:structARM__I2C__CAPABILITIES"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:structARM__I2C__STATUS"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#structARM__I2C__STATUS">ARM_I2C_STATUS</a></td></tr>
<tr class="memdesc:structARM__I2C__STATUS"><td class="mdescLeft">&#160;</td><td class="mdescRight">I2C Status.  <a href="group__i2c__interface__gr.html#structARM__I2C__STATUS">More...</a><br/></td></tr>
<tr class="separator:structARM__I2C__STATUS"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:ga24277c48248a09b0dd7f12bbe22ce13c"><td class="memItemLeft" align="right" valign="top">typedef void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#ga24277c48248a09b0dd7f12bbe22ce13c">ARM_I2C_SignalEvent_t</a> )(uint32_t event)</td></tr>
<tr class="memdesc:ga24277c48248a09b0dd7f12bbe22ce13c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to <a class="el" href="group__i2c__interface__gr.html#gad4f93d2895794b416dc8d8e9de91c05e">ARM_I2C_SignalEvent</a> : Signal I2C Event.  <a href="#ga24277c48248a09b0dd7f12bbe22ce13c">More...</a><br/></td></tr>
<tr class="separator:ga24277c48248a09b0dd7f12bbe22ce13c"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga956bd87590c7fb6e23609a0abfb5412c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__common__drv__gr.html#structARM__DRIVER__VERSION">ARM_DRIVER_VERSION</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#ga956bd87590c7fb6e23609a0abfb5412c">ARM_I2C_GetVersion</a> (void)</td></tr>
<tr class="memdesc:ga956bd87590c7fb6e23609a0abfb5412c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get driver version.  <a href="#ga956bd87590c7fb6e23609a0abfb5412c">More...</a><br/></td></tr>
<tr class="separator:ga956bd87590c7fb6e23609a0abfb5412c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad20e6731f627aa7b9d6e99a50806122e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__i2c__interface__gr.html#structARM__I2C__CAPABILITIES">ARM_I2C_CAPABILITIES</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#gad20e6731f627aa7b9d6e99a50806122e">ARM_I2C_GetCapabilities</a> (void)</td></tr>
<tr class="memdesc:gad20e6731f627aa7b9d6e99a50806122e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get driver capabilities.  <a href="#gad20e6731f627aa7b9d6e99a50806122e">More...</a><br/></td></tr>
<tr class="separator:gad20e6731f627aa7b9d6e99a50806122e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga79d2f7d01b3a681d1cf0d70ac6692696"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#ga79d2f7d01b3a681d1cf0d70ac6692696">ARM_I2C_Initialize</a> (<a class="el" href="group__i2c__interface__gr.html#ga24277c48248a09b0dd7f12bbe22ce13c">ARM_I2C_SignalEvent_t</a> cb_event)</td></tr>
<tr class="memdesc:ga79d2f7d01b3a681d1cf0d70ac6692696"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize I2C Interface.  <a href="#ga79d2f7d01b3a681d1cf0d70ac6692696">More...</a><br/></td></tr>
<tr class="separator:ga79d2f7d01b3a681d1cf0d70ac6692696"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga30d8bf600b6b3182a1f867407b3d6e75"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#ga30d8bf600b6b3182a1f867407b3d6e75">ARM_I2C_Uninitialize</a> (void)</td></tr>
<tr class="memdesc:ga30d8bf600b6b3182a1f867407b3d6e75"><td class="mdescLeft">&#160;</td><td class="mdescRight">De-initialize I2C Interface.  <a href="#ga30d8bf600b6b3182a1f867407b3d6e75">More...</a><br/></td></tr>
<tr class="separator:ga30d8bf600b6b3182a1f867407b3d6e75"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga734a69200e063fdbfb5110062afe9329"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#ga734a69200e063fdbfb5110062afe9329">ARM_I2C_PowerControl</a> (<a class="el" href="group__common__drv__gr.html#ga47d6d7c31f88f3b8ae4aaf9d8444afa5">ARM_POWER_STATE</a> state)</td></tr>
<tr class="memdesc:ga734a69200e063fdbfb5110062afe9329"><td class="mdescLeft">&#160;</td><td class="mdescRight">Control I2C Interface Power.  <a href="#ga734a69200e063fdbfb5110062afe9329">More...</a><br/></td></tr>
<tr class="separator:ga734a69200e063fdbfb5110062afe9329"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8bf4214580149d5a5d2360f71f0feb94"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#ga8bf4214580149d5a5d2360f71f0feb94">ARM_I2C_MasterTransmit</a> (uint32_t addr, const uint8_t *data, uint32_t num, bool xfer_pending)</td></tr>
<tr class="memdesc:ga8bf4214580149d5a5d2360f71f0feb94"><td class="mdescLeft">&#160;</td><td class="mdescRight">Start transmitting data as I2C Master.  <a href="#ga8bf4214580149d5a5d2360f71f0feb94">More...</a><br/></td></tr>
<tr class="separator:ga8bf4214580149d5a5d2360f71f0feb94"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gafa22504bcf88a85584dfe6e0dd270ad5"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#gafa22504bcf88a85584dfe6e0dd270ad5">ARM_I2C_MasterReceive</a> (uint32_t addr, uint8_t *data, uint32_t num, bool xfer_pending)</td></tr>
<tr class="memdesc:gafa22504bcf88a85584dfe6e0dd270ad5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Start receiving data as I2C Master.  <a href="#gafa22504bcf88a85584dfe6e0dd270ad5">More...</a><br/></td></tr>
<tr class="separator:gafa22504bcf88a85584dfe6e0dd270ad5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gafe164f30eba78f066272373b98a62cd4"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#gafe164f30eba78f066272373b98a62cd4">ARM_I2C_SlaveTransmit</a> (const uint8_t *data, uint32_t num)</td></tr>
<tr class="memdesc:gafe164f30eba78f066272373b98a62cd4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Start transmitting data as I2C Slave.  <a href="#gafe164f30eba78f066272373b98a62cd4">More...</a><br/></td></tr>
<tr class="separator:gafe164f30eba78f066272373b98a62cd4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae3c9abccd1d377385d3d4cfe29035164"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#gae3c9abccd1d377385d3d4cfe29035164">ARM_I2C_SlaveReceive</a> (uint8_t *data, uint32_t num)</td></tr>
<tr class="memdesc:gae3c9abccd1d377385d3d4cfe29035164"><td class="mdescLeft">&#160;</td><td class="mdescRight">Start receiving data as I2C Slave.  <a href="#gae3c9abccd1d377385d3d4cfe29035164">More...</a><br/></td></tr>
<tr class="separator:gae3c9abccd1d377385d3d4cfe29035164"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga19db20ad8d7fde84d07f6db4d75f4b7c"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#ga19db20ad8d7fde84d07f6db4d75f4b7c">ARM_I2C_GetDataCount</a> (void)</td></tr>
<tr class="memdesc:ga19db20ad8d7fde84d07f6db4d75f4b7c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get transferred data count.  <a href="#ga19db20ad8d7fde84d07f6db4d75f4b7c">More...</a><br/></td></tr>
<tr class="separator:ga19db20ad8d7fde84d07f6db4d75f4b7c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga828f5fa289d065675ef78a9a73d129dc"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#ga828f5fa289d065675ef78a9a73d129dc">ARM_I2C_Control</a> (uint32_t control, uint32_t arg)</td></tr>
<tr class="memdesc:ga828f5fa289d065675ef78a9a73d129dc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Control I2C Interface.  <a href="#ga828f5fa289d065675ef78a9a73d129dc">More...</a><br/></td></tr>
<tr class="separator:ga828f5fa289d065675ef78a9a73d129dc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaba4e0f3eb4018e7dafd51b675c465f3e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__i2c__interface__gr.html#structARM__I2C__STATUS">ARM_I2C_STATUS</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#gaba4e0f3eb4018e7dafd51b675c465f3e">ARM_I2C_GetStatus</a> (void)</td></tr>
<tr class="memdesc:gaba4e0f3eb4018e7dafd51b675c465f3e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get I2C status.  <a href="#gaba4e0f3eb4018e7dafd51b675c465f3e">More...</a><br/></td></tr>
<tr class="separator:gaba4e0f3eb4018e7dafd51b675c465f3e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad4f93d2895794b416dc8d8e9de91c05e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#gad4f93d2895794b416dc8d8e9de91c05e">ARM_I2C_SignalEvent</a> (uint32_t event)</td></tr>
<tr class="memdesc:gad4f93d2895794b416dc8d8e9de91c05e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Signal I2C Events.  <a href="#gad4f93d2895794b416dc8d8e9de91c05e">More...</a><br/></td></tr>
<tr class="separator:gad4f93d2895794b416dc8d8e9de91c05e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Description</h2>
<p>Driver API for I2C Bus Peripheral (Driver_I2C.h) </p>
<p>I<sup>2</sup>C (Inter-Integrated Circuit, referred to as I-squared-C, I-two-C, or IIC) is a multi-master serial single-ended bus and is mostly used on single boards, but can also connect to components which are linked via cable.</p>
<p>Most significant features of the I<sup>2</sup>C bus include:</p>
<ul>
<li>Only two bus lines are required</li>
<li>I<sup>2</sup>C is a true multi-master bus. Simple master/slave relationships exist between all components</li>
<li>A baud rate is not required; the master device determines a bus clock</li>
<li>Each connected device is addressable by a unique address</li>
<li>Providing arbitration and collision detection</li>
</ul>
<p>For more information about I<sup>2</sup>C refer to the following web pages:</p>
<ul>
<li>Wikipedia: <a href="http://en.wikipedia.org/wiki/I%C2%B2C" target="_blank">I<sup>2</sup>C</a></li>
<li><a href="http://www.i2c-bus.org" target="_blank">www.i2c-bus.org</a>.</li>
</ul>
<p>Devices can operation in Master or Slave mode:</p>
<ul>
<li>To operate in Master mode call the functions <a class="el" href="group__i2c__interface__gr.html#ga8bf4214580149d5a5d2360f71f0feb94">ARM_I2C_MasterTransmit</a> or <a class="el" href="group__i2c__interface__gr.html#gafa22504bcf88a85584dfe6e0dd270ad5">ARM_I2C_MasterReceive</a>. These functions get as argument a <em>slave address</em>.</li>
<li>To operate in Slave mode set the <em>slave address</em> using the function <a class="el" href="group__i2c__interface__gr.html#ga828f5fa289d065675ef78a9a73d129dc">ARM_I2C_Control</a>. The functions <a class="el" href="group__i2c__interface__gr.html#gafe164f30eba78f066272373b98a62cd4">ARM_I2C_SlaveTransmit</a> or <a class="el" href="group__i2c__interface__gr.html#gae3c9abccd1d377385d3d4cfe29035164">ARM_I2C_SlaveReceive</a> are used to transfer data in Slave mode.</li>
</ul>
<p><b>I<sup>2</sup>C Slave Address</b></p>
<p>Depending on the device, I<sup>2</sup>C supports 7-bit and 10-bit Slaves addresses. The element <em>address_10_bit</em> in <a class="el" href="group__i2c__interface__gr.html#structARM__I2C__CAPABILITIES">ARM_I2C_CAPABILITIES</a> indicates that the driver is able to handle 10-bit addresses. A 10-bit Slave address is ORed with <a class="el" href="group__i2c__address__flags.html#ga16be1861b90774bf062feab2dbb829a4">ARM_I2C_ADDRESS_10BIT</a>.</p>
<p>I<sup>2</sup>C also supports a General Call to all Slaves by using the slave address value <span class="XML-Token">0</span>. A General Call is recognized by Slaves have a slave address value <a class="el" href="group__i2c__address__flags.html#ga337f4f1aa082e9b593b2dcd43c50134e">ARM_I2C_ADDRESS_GC</a> registered with the function <a class="el" href="group__i2c__interface__gr.html#ga828f5fa289d065675ef78a9a73d129dc">ARM_I2C_Control</a>.</p>
<p><b>Block Diagram</b></p>
<p>The I2C driver allows you to connect low-speed peripherals to a motherboard, embedded system, cellphone, or other electronic device.</p>
<div class="image">
<img src="I2C_BlockDiagram.png" alt="I2C_BlockDiagram.png"/>
<div class="caption">
Master/Slave connected via I2C interface</div></div>
<p><b>I<sup>2</sup>C API</b></p>
<p>The following header files define the Application Programming Interface (API) for the I<sup>2</sup>C interface:</p>
<ul>
<li><b>Driver_I2C.h</b> : Driver API for I2C Bus Peripheral</li>
</ul>
<p>The driver implementation is a typical part of the Device Family Pack (DFP) that supports the peripherals of the microcontroller family.</p>
<p><b>Driver Functions</b></p>
<p>The driver functions are published in the access struct as explained in <a class="el" href="theoryOperation.html#DriverFunctions">Common Driver Functions</a></p>
<ul>
<li><a class="el" href="group__i2c__interface__gr.html#structARM__DRIVER__I2C">ARM_DRIVER_I2C</a> : access struct for I2C driver functions</li>
</ul>
<p><a class="anchor" id="example"></a><b>Example Code</b></p>
<p>The following example code shows the usage of the I<sup>2</sup>C interface in Master mode.</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="Driver__I2C_8h.html">Driver_I2C.h</a>&quot;</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#define EEPROM_I2C_ADDR       0x51      </span><span class="comment">/* EEPROM I2C address */</span><span class="preprocessor"></span></div>
<div class="line"><span class="preprocessor"></span> </div>
<div class="line"><span class="comment">/* I2C driver instance */</span></div>
<div class="line"><span class="keyword">extern</span> <a class="code" href="group__i2c__interface__gr.html#structARM__DRIVER__I2C">ARM_DRIVER_I2C</a>            Driver_I2C0;</div>
<div class="line"><span class="keyword">static</span> <a class="code" href="group__i2c__interface__gr.html#structARM__DRIVER__I2C">ARM_DRIVER_I2C</a> *I2Cdrv = &amp;Driver_I2C0;</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keyword">volatile</span> uint32_t I2C_Event;</div>
<div class="line"> </div>
<div class="line"><span class="comment">/* I2C Signal Event function callback */</span></div>
<div class="line"><span class="keywordtype">void</span> I2C_SignalEvent (uint32_t event) {</div>
<div class="line"> </div>
<div class="line">  <span class="comment">/* Save received events */</span></div>
<div class="line">  I2C_Event |= event;</div>
<div class="line"> </div>
<div class="line">  <span class="comment">/* Optionally, user can define specific actions for an event */</span></div>
<div class="line"> </div>
<div class="line">  <span class="keywordflow">if</span> (event &amp; <a class="code" href="group__I2C__events.html#gafac3989c7b57727e1bed4ee9f2496ac9">ARM_I2C_EVENT_TRANSFER_INCOMPLETE</a>) {</div>
<div class="line">    <span class="comment">/* Less data was transferred than requested */</span></div>
<div class="line">  }</div>
<div class="line"> </div>
<div class="line">  <span class="keywordflow">if</span> (event &amp; <a class="code" href="group__I2C__events.html#ga5992dc0f6e839c4d066cfa83d535f30d">ARM_I2C_EVENT_TRANSFER_DONE</a>) {</div>
<div class="line">    <span class="comment">/* Transfer or receive is finished */</span></div>
<div class="line">  }</div>
<div class="line"> </div>
<div class="line">  <span class="keywordflow">if</span> (event &amp; <a class="code" href="group__I2C__events.html#ga98b815769634d9578526b43589caa017">ARM_I2C_EVENT_ADDRESS_NACK</a>) {</div>
<div class="line">    <span class="comment">/* Slave address was not acknowledged */</span></div>
<div class="line">  }</div>
<div class="line"> </div>
<div class="line">  <span class="keywordflow">if</span> (event &amp; <a class="code" href="group__I2C__events.html#gac9000f44a578e2117d64dbc2093cec6d">ARM_I2C_EVENT_ARBITRATION_LOST</a>) {</div>
<div class="line">    <span class="comment">/* Master lost bus arbitration */</span></div>
<div class="line">  }</div>
<div class="line"> </div>
<div class="line">  <span class="keywordflow">if</span> (event &amp; <a class="code" href="group__I2C__events.html#gaeef542840355131c18b53fd9ed1904a8">ARM_I2C_EVENT_BUS_ERROR</a>) {</div>
<div class="line">    <span class="comment">/* Invalid start/stop position detected */</span></div>
<div class="line">  }</div>
<div class="line"> </div>
<div class="line">  <span class="keywordflow">if</span> (event &amp; <a class="code" href="group__I2C__events.html#ga81ca21fad73dac1ffaff58921f848ea9">ARM_I2C_EVENT_BUS_CLEAR</a>) {</div>
<div class="line">    <span class="comment">/* Bus clear operation completed */</span></div>
<div class="line">  }</div>
<div class="line"> </div>
<div class="line">  <span class="keywordflow">if</span> (event &amp; <a class="code" href="group__I2C__events.html#ga3ab54410b6410ed3a58762ff0c0d68b9">ARM_I2C_EVENT_GENERAL_CALL</a>) {</div>
<div class="line">    <span class="comment">/* Slave was addressed with a general call address */</span></div>
<div class="line">  }</div>
<div class="line"> </div>
<div class="line">  <span class="keywordflow">if</span> (event &amp; <a class="code" href="group__I2C__events.html#gabd875b57ce39dadd849c53b885ad6661">ARM_I2C_EVENT_SLAVE_RECEIVE</a>) {</div>
<div class="line">    <span class="comment">/* Slave addressed as receiver but SlaveReceive operation is not started */</span></div>
<div class="line">  }</div>
<div class="line"> </div>
<div class="line">  <span class="keywordflow">if</span> (event &amp; <a class="code" href="group__I2C__events.html#gacfbbec9af083d35e8ea87ad16e9c6ec2">ARM_I2C_EVENT_SLAVE_TRANSMIT</a>) {</div>
<div class="line">    <span class="comment">/* Slave addressed as transmitter but SlaveTransmit operation is not started */</span></div>
<div class="line">  }</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="comment">/* Read I2C connected EEPROM (event driven example) */</span></div>
<div class="line">int32_t EEPROM_Read_Event (uint16_t addr, uint8_t *buf, uint32_t len) {</div>
<div class="line">  uint8_t a[2];</div>
<div class="line"> </div>
<div class="line">  a[0] = (uint8_t)(addr &gt;&gt; 8);</div>
<div class="line">  a[1] = (uint8_t)(addr &amp; 0xFF);</div>
<div class="line"></div>
<div class="line">  <span class="comment">/* Clear event flags before new transfer */</span></div>
<div class="line">  I2C_Event = 0U;</div>
<div class="line"> </div>
<div class="line">  I2Cdrv-&gt;<a class="code" href="group__i2c__interface__gr.html#a9e58f7ea5fd9476e06b45c70b6696b95">MasterTransmit</a> (EEPROM_I2C_ADDR, a, 2, <span class="keyword">true</span>);</div>
<div class="line"> </div>
<div class="line">  <span class="comment">/* Wait until transfer completed */</span></div>
<div class="line">  <span class="keywordflow">while</span> ((I2C_Event &amp; ARM_I2C_EVENT_TRANSFER_DONE) == 0U);</div>
<div class="line">  <span class="comment">/* Check if all data transferred */</span></div>
<div class="line">  <span class="keywordflow">if</span> ((I2C_Event &amp; ARM_I2C_EVENT_TRANSFER_INCOMPLETE) != 0U) <span class="keywordflow">return</span> -1;</div>
<div class="line"> </div>
<div class="line">  <span class="comment">/* Clear event flags before new transfer */</span></div>
<div class="line">  I2C_Event = 0U;</div>
<div class="line"> </div>
<div class="line">  I2Cdrv-&gt;<a class="code" href="group__i2c__interface__gr.html#aa135ff2f4832d35ceb5d7e248159b981">MasterReceive</a> (EEPROM_I2C_ADDR, buf, len, <span class="keyword">false</span>);</div>
<div class="line"> </div>
<div class="line">  <span class="comment">/* Wait until transfer completed */</span></div>
<div class="line">  <span class="keywordflow">while</span> ((I2C_Event &amp; ARM_I2C_EVENT_TRANSFER_DONE) == 0U);</div>
<div class="line">  <span class="comment">/* Check if all data transferred */</span></div>
<div class="line">  <span class="keywordflow">if</span> ((I2C_Event &amp; ARM_I2C_EVENT_TRANSFER_INCOMPLETE) != 0U) <span class="keywordflow">return</span> -1;</div>
<div class="line"> </div>
<div class="line">  <span class="keywordflow">return</span> 0;</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="comment">/* Read I2C connected EEPROM (pooling example) */</span></div>
<div class="line">int32_t EEPROM_Read_Pool (uint16_t addr, uint8_t *buf, uint32_t len) {</div>
<div class="line">  uint8_t a[2];</div>
<div class="line"> </div>
<div class="line">  a[0] = (uint8_t)(addr &gt;&gt; 8);</div>
<div class="line">  a[1] = (uint8_t)(addr &amp; 0xFF);</div>
<div class="line"> </div>
<div class="line">  I2Cdrv-&gt;<a class="code" href="group__i2c__interface__gr.html#a9e58f7ea5fd9476e06b45c70b6696b95">MasterTransmit</a> (EEPROM_I2C_ADDR, a, 2, <span class="keyword">true</span>);</div>
<div class="line"> </div>
<div class="line">  <span class="comment">/* Wait until transfer completed */</span></div>
<div class="line">  <span class="keywordflow">while</span> (I2Cdrv-&gt;<a class="code" href="group__i2c__interface__gr.html#ad4b47653bc47cdb02965dd311e88b96a">GetStatus</a>().<a class="code" href="group__i2c__interface__gr.html#a50c88f3c1d787773e2ac1b59533f034a">busy</a>);</div>
<div class="line">  <span class="comment">/* Check if all data transferred */</span></div>
<div class="line">  <span class="keywordflow">if</span> (I2Cdrv-&gt;<a class="code" href="group__i2c__interface__gr.html#ad421a9b9b07fd6d3e6537396c2b98788">GetDataCount</a> () != len) <span class="keywordflow">return</span> -1;</div>
<div class="line"> </div>
<div class="line">  I2Cdrv-&gt;<a class="code" href="group__i2c__interface__gr.html#aa135ff2f4832d35ceb5d7e248159b981">MasterReceive</a> (EEPROM_I2C_ADDR, buf, len, <span class="keyword">false</span>);</div>
<div class="line"> </div>
<div class="line">  <span class="comment">/* Wait until transfer completed */</span></div>
<div class="line">  <span class="keywordflow">while</span> (I2Cdrv-&gt;<a class="code" href="group__i2c__interface__gr.html#ad4b47653bc47cdb02965dd311e88b96a">GetStatus</a>().<a class="code" href="group__i2c__interface__gr.html#a50c88f3c1d787773e2ac1b59533f034a">busy</a>);</div>
<div class="line">  <span class="comment">/* Check if all data transferred */</span></div>
<div class="line">  <span class="keywordflow">if</span> (I2Cdrv-&gt;<a class="code" href="group__i2c__interface__gr.html#ad421a9b9b07fd6d3e6537396c2b98788">GetDataCount</a> () != len) <span class="keywordflow">return</span> -1;</div>
<div class="line"> </div>
<div class="line">  <span class="keywordflow">return</span> 0;</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">/* Initialize I2C connected EEPROM */</span></div>
<div class="line">int32_t EEPROM_Initialize (<span class="keywordtype">bool</span> pooling) {</div>
<div class="line">  int32_t status;</div>
<div class="line">  uint8_t val;</div>
<div class="line"> </div>
<div class="line">  <span class="keywordflow">if</span> (pooling == <span class="keyword">true</span>) {</div>
<div class="line">    I2Cdrv-&gt;<a class="code" href="group__i2c__interface__gr.html#ab0480980f67e0ebe0461ccea7873a65b">Initialize</a> (NULL);</div>
<div class="line">  } <span class="keywordflow">else</span> {</div>
<div class="line">    I2Cdrv-&gt;<a class="code" href="group__i2c__interface__gr.html#ab0480980f67e0ebe0461ccea7873a65b">Initialize</a> (I2C_SignalEvent);</div>
<div class="line">  }</div>
<div class="line">  I2Cdrv-&gt;<a class="code" href="group__i2c__interface__gr.html#aba8f1c8019af95ffe19c32403e3240ef">PowerControl</a> (<a class="code" href="Driver__Common_8h.html#ga47d6d7c31f88f3b8ae4aaf9d8444afa5abed52b77a9ce4775570e44a842b1295e">ARM_POWER_FULL</a>);</div>
<div class="line">  I2Cdrv-&gt;<a class="code" href="group__i2c__interface__gr.html#a6e0f47a92f626a971c5197fca6545505">Control</a>      (<a class="code" href="group__i2c__control__codes.html#ga35733133237d65146abd9449f5353a7f">ARM_I2C_BUS_SPEED</a>, <a class="code" href="group__i2c__bus__speed__ctrls.html#ga39f49ef4cd1100a8d9dc9003329e5ecd">ARM_I2C_BUS_SPEED_FAST</a>);</div>
<div class="line">  I2Cdrv-&gt;<a class="code" href="group__i2c__interface__gr.html#a6e0f47a92f626a971c5197fca6545505">Control</a>      (<a class="code" href="group__i2c__control__codes.html#gadacf04578770faca4b3eaae34b2c5f03">ARM_I2C_BUS_CLEAR</a>, 0);</div>
<div class="line"> </div>
<div class="line">  <span class="comment">/* Check if EEPROM can be accessed */</span></div>
<div class="line">  <span class="keywordflow">if</span> (pooling == <span class="keyword">true</span>) {</div>
<div class="line">    status = EEPROM_Read_Pool (0x00, &amp;val, 1);</div>
<div class="line">  } <span class="keywordflow">else</span> {</div>
<div class="line">    status = EEPROM_Read_Event (0x00, &amp;val, 1);</div>
<div class="line">  }</div>
<div class="line"> </div>
<div class="line">  <span class="keywordflow">return</span> (status);</div>
<div class="line">}</div>
</div><!-- fragment --><p>The following example code shows the usage of the I<sup>2</sup>C interface in Slave mode.</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="Driver__I2C_8h.html">Driver_I2C.h</a>&quot;</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">/* I2C driver instance */</span></div>
<div class="line"><span class="keyword">extern</span> <a class="code" href="group__i2c__interface__gr.html#structARM__DRIVER__I2C">ARM_DRIVER_I2C</a>            Driver_I2C0; </div>
<div class="line"><span class="keyword">static</span> <a class="code" href="group__i2c__interface__gr.html#structARM__DRIVER__I2C">ARM_DRIVER_I2C</a> *I2Cdrv = &amp;Driver_I2C0;</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keyword">volatile</span> uint32_t I2C_Event;</div>
<div class="line"> </div>
<div class="line"><span class="comment">/* I2C Signal Event function callback */</span></div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> I2C_SignalEvent (uint32_t event) {</div>
<div class="line">  I2C_Event |= event;</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main (<span class="keywordtype">void</span>) {</div>
<div class="line">  uint8_t cnt = 0;</div>
<div class="line"> </div>
<div class="line">  <span class="comment">/* Initialize I2C peripheral */</span></div>
<div class="line">  I2Cdrv-&gt;<a class="code" href="group__i2c__interface__gr.html#ab0480980f67e0ebe0461ccea7873a65b">Initialize</a>(I2C_SignalEvent);</div>
<div class="line"> </div>
<div class="line">  <span class="comment">/* Power-on I2C peripheral */</span></div>
<div class="line">  I2Cdrv-&gt;<a class="code" href="group__i2c__interface__gr.html#aba8f1c8019af95ffe19c32403e3240ef">PowerControl</a>(<a class="code" href="Driver__Common_8h.html#ga47d6d7c31f88f3b8ae4aaf9d8444afa5abed52b77a9ce4775570e44a842b1295e">ARM_POWER_FULL</a>);</div>
<div class="line"> </div>
<div class="line">  <span class="comment">/* Configure I2C bus */</span></div>
<div class="line">  I2Cdrv-&gt;<a class="code" href="group__i2c__interface__gr.html#a6e0f47a92f626a971c5197fca6545505">Control</a>(<a class="code" href="group__i2c__control__codes.html#ga69d130b9f8aa34d6df5334ab67c74307">ARM_I2C_OWN_ADDRESS</a>, 0x78);</div>
<div class="line"> </div>
<div class="line">  I2C_Event = 0;</div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">while</span> (1) {</div>
<div class="line">    <span class="comment">/* Receive chunk */</span></div>
<div class="line">    I2Cdrv-&gt;<a class="code" href="group__i2c__interface__gr.html#a12d2689d6e93985e64b9561a8e4e917b">SlaveReceive</a>(&amp;cnt, 1);</div>
<div class="line">    <span class="keywordflow">while</span> ((I2C_Event &amp; ARM_I2C_EVENT_TRANSFER_DONE) == 0);</div>
<div class="line">    <span class="comment">/* Clear transfer done flag */</span></div>
<div class="line">    I2C_Event &amp;= ~ARM_I2C_EVENT_TRANSFER_DONE;</div>
<div class="line"> </div>
<div class="line">    <span class="comment">/* Transmit chunk back */</span></div>
<div class="line">    I2Cdrv-&gt;<a class="code" href="group__i2c__interface__gr.html#ae9e3b81b352d4564fd2337fdf0e5488c">SlaveTransmit</a>(&amp;cnt, 1);</div>
<div class="line">    <span class="keywordflow">while</span> ((I2C_Event &amp; ARM_I2C_EVENT_TRANSFER_DONE) == 0);</div>
<div class="line">    <span class="comment">/* Clear transfer done flag */</span></div>
<div class="line">    I2C_Event &amp;= ~ARM_I2C_EVENT_TRANSFER_DONE;</div>
<div class="line">  }</div>
<div class="line">}</div>
</div><!-- fragment --> <hr/><h2 class="groupheader">Data Structure Documentation</h2>
<a name="structARM__DRIVER__I2C" id="structARM__DRIVER__I2C"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct ARM_DRIVER_I2C</td>
        </tr>
      </table>
</div><div class="memdoc">
<div class="textblock"><p>Access structure of the I2C Driver. </p>
<p>The functions of the I2C interface are accessed by function pointers exposed by this structure. Refer to <a class="el" href="theoryOperation.html#DriverFunctions">Common Driver Functions</a> for overview information.</p>
<p>Each instance of an I2C provides such an access structure. The instance is indicated by a postfix in the symbol name of the access structure, for example:</p>
<ul>
<li><b>Driver_I2C0</b> is the name of the access struct of the first instance (no. 0).</li>
<li><b>Driver_I2C1</b> is the name of the access struct of the second instance (no. 1).</li>
</ul>
<p>A configuration setting in the middleware allows connecting the middleware to a specific driver instance <b>Driver_I2C<em>n</em></b>. The default is <span class="XML-Token">0</span>, which connects a middleware to the first instance of a driver. </p>
</div><table class="memberdecls">
<tr><td colspan="2"><h3>Data Fields</h3></td></tr>
<tr class="memitem:a8834b281da48583845c044a81566c1b3"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__common__drv__gr.html#structARM__DRIVER__VERSION">ARM_DRIVER_VERSION</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#a8834b281da48583845c044a81566c1b3">GetVersion</a> )(void)</td></tr>
<tr class="memdesc:a8834b281da48583845c044a81566c1b3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to <a class="el" href="group__i2c__interface__gr.html#ga956bd87590c7fb6e23609a0abfb5412c">ARM_I2C_GetVersion</a> : Get driver version.  <a href="#a8834b281da48583845c044a81566c1b3">More...</a><br/></td></tr>
<tr class="separator:a8834b281da48583845c044a81566c1b3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5dfa74ca82e0af995d43da61e08c3103"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__i2c__interface__gr.html#structARM__I2C__CAPABILITIES">ARM_I2C_CAPABILITIES</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#a5dfa74ca82e0af995d43da61e08c3103">GetCapabilities</a> )(void)</td></tr>
<tr class="memdesc:a5dfa74ca82e0af995d43da61e08c3103"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to <a class="el" href="group__i2c__interface__gr.html#gad20e6731f627aa7b9d6e99a50806122e">ARM_I2C_GetCapabilities</a> : Get driver capabilities.  <a href="#a5dfa74ca82e0af995d43da61e08c3103">More...</a><br/></td></tr>
<tr class="separator:a5dfa74ca82e0af995d43da61e08c3103"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab0480980f67e0ebe0461ccea7873a65b"><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#ab0480980f67e0ebe0461ccea7873a65b">Initialize</a> )(<a class="el" href="group__i2c__interface__gr.html#ga24277c48248a09b0dd7f12bbe22ce13c">ARM_I2C_SignalEvent_t</a> cb_event)</td></tr>
<tr class="memdesc:ab0480980f67e0ebe0461ccea7873a65b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to <a class="el" href="group__i2c__interface__gr.html#ga79d2f7d01b3a681d1cf0d70ac6692696">ARM_I2C_Initialize</a> : Initialize I2C Interface.  <a href="#ab0480980f67e0ebe0461ccea7873a65b">More...</a><br/></td></tr>
<tr class="separator:ab0480980f67e0ebe0461ccea7873a65b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adcf20681a1402869ecb5c6447fada17b"><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#adcf20681a1402869ecb5c6447fada17b">Uninitialize</a> )(void)</td></tr>
<tr class="memdesc:adcf20681a1402869ecb5c6447fada17b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to <a class="el" href="group__i2c__interface__gr.html#ga30d8bf600b6b3182a1f867407b3d6e75">ARM_I2C_Uninitialize</a> : De-initialize I2C Interface.  <a href="#adcf20681a1402869ecb5c6447fada17b">More...</a><br/></td></tr>
<tr class="separator:adcf20681a1402869ecb5c6447fada17b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aba8f1c8019af95ffe19c32403e3240ef"><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#aba8f1c8019af95ffe19c32403e3240ef">PowerControl</a> )(<a class="el" href="group__common__drv__gr.html#ga47d6d7c31f88f3b8ae4aaf9d8444afa5">ARM_POWER_STATE</a> state)</td></tr>
<tr class="memdesc:aba8f1c8019af95ffe19c32403e3240ef"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to <a class="el" href="group__i2c__interface__gr.html#ga734a69200e063fdbfb5110062afe9329">ARM_I2C_PowerControl</a> : Control I2C Interface Power.  <a href="#aba8f1c8019af95ffe19c32403e3240ef">More...</a><br/></td></tr>
<tr class="separator:aba8f1c8019af95ffe19c32403e3240ef"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9e58f7ea5fd9476e06b45c70b6696b95"><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#a9e58f7ea5fd9476e06b45c70b6696b95">MasterTransmit</a> )(uint32_t addr, const uint8_t *data, uint32_t num, bool xfer_pending)</td></tr>
<tr class="memdesc:a9e58f7ea5fd9476e06b45c70b6696b95"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to <a class="el" href="group__i2c__interface__gr.html#ga8bf4214580149d5a5d2360f71f0feb94">ARM_I2C_MasterTransmit</a> : Start transmitting data as I2C Master.  <a href="#a9e58f7ea5fd9476e06b45c70b6696b95">More...</a><br/></td></tr>
<tr class="separator:a9e58f7ea5fd9476e06b45c70b6696b95"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa135ff2f4832d35ceb5d7e248159b981"><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#aa135ff2f4832d35ceb5d7e248159b981">MasterReceive</a> )(uint32_t addr, uint8_t *data, uint32_t num, bool xfer_pending)</td></tr>
<tr class="memdesc:aa135ff2f4832d35ceb5d7e248159b981"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to <a class="el" href="group__i2c__interface__gr.html#gafa22504bcf88a85584dfe6e0dd270ad5">ARM_I2C_MasterReceive</a> : Start receiving data as I2C Master.  <a href="#aa135ff2f4832d35ceb5d7e248159b981">More...</a><br/></td></tr>
<tr class="separator:aa135ff2f4832d35ceb5d7e248159b981"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae9e3b81b352d4564fd2337fdf0e5488c"><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#ae9e3b81b352d4564fd2337fdf0e5488c">SlaveTransmit</a> )(const uint8_t *data, uint32_t num)</td></tr>
<tr class="memdesc:ae9e3b81b352d4564fd2337fdf0e5488c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to <a class="el" href="group__i2c__interface__gr.html#gafe164f30eba78f066272373b98a62cd4">ARM_I2C_SlaveTransmit</a> : Start transmitting data as I2C Slave.  <a href="#ae9e3b81b352d4564fd2337fdf0e5488c">More...</a><br/></td></tr>
<tr class="separator:ae9e3b81b352d4564fd2337fdf0e5488c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a12d2689d6e93985e64b9561a8e4e917b"><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#a12d2689d6e93985e64b9561a8e4e917b">SlaveReceive</a> )(uint8_t *data, uint32_t num)</td></tr>
<tr class="memdesc:a12d2689d6e93985e64b9561a8e4e917b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to <a class="el" href="group__i2c__interface__gr.html#gae3c9abccd1d377385d3d4cfe29035164">ARM_I2C_SlaveReceive</a> : Start receiving data as I2C Slave.  <a href="#a12d2689d6e93985e64b9561a8e4e917b">More...</a><br/></td></tr>
<tr class="separator:a12d2689d6e93985e64b9561a8e4e917b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad421a9b9b07fd6d3e6537396c2b98788"><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#ad421a9b9b07fd6d3e6537396c2b98788">GetDataCount</a> )(void)</td></tr>
<tr class="memdesc:ad421a9b9b07fd6d3e6537396c2b98788"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to <a class="el" href="group__i2c__interface__gr.html#ga19db20ad8d7fde84d07f6db4d75f4b7c">ARM_I2C_GetDataCount</a> : Get transferred data count.  <a href="#ad421a9b9b07fd6d3e6537396c2b98788">More...</a><br/></td></tr>
<tr class="separator:ad421a9b9b07fd6d3e6537396c2b98788"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6e0f47a92f626a971c5197fca6545505"><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#a6e0f47a92f626a971c5197fca6545505">Control</a> )(uint32_t control, uint32_t arg)</td></tr>
<tr class="memdesc:a6e0f47a92f626a971c5197fca6545505"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to <a class="el" href="group__i2c__interface__gr.html#ga828f5fa289d065675ef78a9a73d129dc">ARM_I2C_Control</a> : Control I2C Interface.  <a href="#a6e0f47a92f626a971c5197fca6545505">More...</a><br/></td></tr>
<tr class="separator:a6e0f47a92f626a971c5197fca6545505"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad4b47653bc47cdb02965dd311e88b96a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__i2c__interface__gr.html#structARM__I2C__STATUS">ARM_I2C_STATUS</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2c__interface__gr.html#ad4b47653bc47cdb02965dd311e88b96a">GetStatus</a> )(void)</td></tr>
<tr class="memdesc:ad4b47653bc47cdb02965dd311e88b96a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to <a class="el" href="group__i2c__interface__gr.html#gaba4e0f3eb4018e7dafd51b675c465f3e">ARM_I2C_GetStatus</a> : Get I2C status.  <a href="#ad4b47653bc47cdb02965dd311e88b96a">More...</a><br/></td></tr>
<tr class="separator:ad4b47653bc47cdb02965dd311e88b96a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h4 class="groupheader">Field Documentation</h4>
<a class="anchor" id="a8834b281da48583845c044a81566c1b3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__common__drv__gr.html#structARM__DRIVER__VERSION">ARM_DRIVER_VERSION</a>(* GetVersion)(void)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Pointer to <a class="el" href="group__i2c__interface__gr.html#ga956bd87590c7fb6e23609a0abfb5412c">ARM_I2C_GetVersion</a> : Get driver version. </p>

</div>
</div>
<a class="anchor" id="a5dfa74ca82e0af995d43da61e08c3103"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__i2c__interface__gr.html#structARM__I2C__CAPABILITIES">ARM_I2C_CAPABILITIES</a>(* GetCapabilities)(void)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Pointer to <a class="el" href="group__i2c__interface__gr.html#gad20e6731f627aa7b9d6e99a50806122e">ARM_I2C_GetCapabilities</a> : Get driver capabilities. </p>

</div>
</div>
<a class="anchor" id="ab0480980f67e0ebe0461ccea7873a65b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t(* Initialize)(<a class="el" href="group__i2c__interface__gr.html#ga24277c48248a09b0dd7f12bbe22ce13c">ARM_I2C_SignalEvent_t</a> cb_event)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Pointer to <a class="el" href="group__i2c__interface__gr.html#ga79d2f7d01b3a681d1cf0d70ac6692696">ARM_I2C_Initialize</a> : Initialize I2C Interface. </p>

</div>
</div>
<a class="anchor" id="adcf20681a1402869ecb5c6447fada17b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t(* Uninitialize)(void)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Pointer to <a class="el" href="group__i2c__interface__gr.html#ga30d8bf600b6b3182a1f867407b3d6e75">ARM_I2C_Uninitialize</a> : De-initialize I2C Interface. </p>

</div>
</div>
<a class="anchor" id="aba8f1c8019af95ffe19c32403e3240ef"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t(* PowerControl)(<a class="el" href="group__common__drv__gr.html#ga47d6d7c31f88f3b8ae4aaf9d8444afa5">ARM_POWER_STATE</a> state)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Pointer to <a class="el" href="group__i2c__interface__gr.html#ga734a69200e063fdbfb5110062afe9329">ARM_I2C_PowerControl</a> : Control I2C Interface Power. </p>

</div>
</div>
<a class="anchor" id="a9e58f7ea5fd9476e06b45c70b6696b95"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t(* MasterTransmit)(uint32_t addr, const uint8_t *data, uint32_t num, bool xfer_pending)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Pointer to <a class="el" href="group__i2c__interface__gr.html#ga8bf4214580149d5a5d2360f71f0feb94">ARM_I2C_MasterTransmit</a> : Start transmitting data as I2C Master. </p>

</div>
</div>
<a class="anchor" id="aa135ff2f4832d35ceb5d7e248159b981"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t(* MasterReceive)(uint32_t addr, uint8_t *data, uint32_t num, bool xfer_pending)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Pointer to <a class="el" href="group__i2c__interface__gr.html#gafa22504bcf88a85584dfe6e0dd270ad5">ARM_I2C_MasterReceive</a> : Start receiving data as I2C Master. </p>

</div>
</div>
<a class="anchor" id="ae9e3b81b352d4564fd2337fdf0e5488c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t(* SlaveTransmit)(const uint8_t *data, uint32_t num)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Pointer to <a class="el" href="group__i2c__interface__gr.html#gafe164f30eba78f066272373b98a62cd4">ARM_I2C_SlaveTransmit</a> : Start transmitting data as I2C Slave. </p>

</div>
</div>
<a class="anchor" id="a12d2689d6e93985e64b9561a8e4e917b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t(* SlaveReceive)(uint8_t *data, uint32_t num)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Pointer to <a class="el" href="group__i2c__interface__gr.html#gae3c9abccd1d377385d3d4cfe29035164">ARM_I2C_SlaveReceive</a> : Start receiving data as I2C Slave. </p>

</div>
</div>
<a class="anchor" id="ad421a9b9b07fd6d3e6537396c2b98788"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t(* GetDataCount)(void)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Pointer to <a class="el" href="group__i2c__interface__gr.html#ga19db20ad8d7fde84d07f6db4d75f4b7c">ARM_I2C_GetDataCount</a> : Get transferred data count. </p>

</div>
</div>
<a class="anchor" id="a6e0f47a92f626a971c5197fca6545505"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t(* Control)(uint32_t control, uint32_t arg)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Pointer to <a class="el" href="group__i2c__interface__gr.html#ga828f5fa289d065675ef78a9a73d129dc">ARM_I2C_Control</a> : Control I2C Interface. </p>

</div>
</div>
<a class="anchor" id="ad4b47653bc47cdb02965dd311e88b96a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__i2c__interface__gr.html#structARM__I2C__STATUS">ARM_I2C_STATUS</a>(* GetStatus)(void)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Pointer to <a class="el" href="group__i2c__interface__gr.html#gaba4e0f3eb4018e7dafd51b675c465f3e">ARM_I2C_GetStatus</a> : Get I2C status. </p>

</div>
</div>

</div>
</div>
<a name="structARM__I2C__CAPABILITIES" id="structARM__I2C__CAPABILITIES"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct ARM_I2C_CAPABILITIES</td>
        </tr>
      </table>
</div><div class="memdoc">
<div class="textblock"><p>I2C Driver Capabilities. </p>
<p>An I2C driver can be implemented with different capabilities. The data fields of this struct encode the capabilities implemented by this driver.</p>
<p>The element <em>address_10_bit</em> indicates that the driver is able to handle 10-bit addressing natively. User can still emulate the 10-bit addressing in software if the driver does not support it.</p>
<p><b>Returned by:</b></p>
<ul>
<li><a class="el" href="group__i2c__interface__gr.html#gad20e6731f627aa7b9d6e99a50806122e">ARM_I2C_GetCapabilities</a> </li>
</ul>
</div><table class="fieldtable">
<tr><th colspan="3">Data Fields</th></tr>
<tr><td class="fieldtype">
<a class="anchor" id="a4ffaaf168a9f43e98d710abff5861ed5"></a>uint32_t</td>
<td class="fieldname">
address_10_bit: 1</td>
<td class="fielddoc">
supports 10-bit addressing </td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="aa43c4c21b173ada1b6b7568956f0d650"></a>uint32_t</td>
<td class="fieldname">
reserved: 31</td>
<td class="fielddoc">
Reserved (must be zero) </td></tr>
</table>

</div>
</div>
<a name="structARM__I2C__STATUS" id="structARM__I2C__STATUS"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct ARM_I2C_STATUS</td>
        </tr>
      </table>
</div><div class="memdoc">
<div class="textblock"><p>I2C Status. </p>
<p>Structure with information about the status of the I2C.</p>
<p>The flag <em>busy</em> indicates that the driver is busy executing Master/Slave Transmit/Receive operation.</p>
<p>It is set:</p>
<ul>
<li>when Master operation starts: after calling <a class="el" href="group__i2c__interface__gr.html#ga8bf4214580149d5a5d2360f71f0feb94">ARM_I2C_MasterTransmit</a> or <a class="el" href="group__i2c__interface__gr.html#gafa22504bcf88a85584dfe6e0dd270ad5">ARM_I2C_MasterReceive</a></li>
<li>when Slave operation starts: after calling <a class="el" href="group__i2c__interface__gr.html#gafe164f30eba78f066272373b98a62cd4">ARM_I2C_SlaveTransmit</a> or <a class="el" href="group__i2c__interface__gr.html#gae3c9abccd1d377385d3d4cfe29035164">ARM_I2C_SlaveReceive</a> and after being addressed by a Master as the Slave</li>
</ul>
<p>It is cleared when Master/Slave operation has finished.</p>
<p>The flag <em>mode</em> indicates the current mode which is Master when Master Transmit/Receive is active or Slave otherwise.</p>
<p>The flag <em>direction</em> indicates either Transmitter or Receiver mode. It is updated during Master/Slave operation when the Slave is addressed by a Master.</p>
<p>The flag <em>general_call</em> indicates a General call (address <span class="XML-Token">0</span>) when in Slave mode.</p>
<p>The flag <em>arbitration_lost</em> indicates that the Master has lost arbitration. The current Master operation is aborted.</p>
<p>The flag <em>bus_error</em> indicates that a bus error has been detected. The current Master/Slave operation is aborted.</p>
<p><b>Returned by:</b></p>
<ul>
<li><a class="el" href="group__i2c__interface__gr.html#gaba4e0f3eb4018e7dafd51b675c465f3e">ARM_I2C_GetStatus</a> </li>
</ul>
</div><table class="fieldtable">
<tr><th colspan="3">Data Fields</th></tr>
<tr><td class="fieldtype">
<a class="anchor" id="a50c88f3c1d787773e2ac1b59533f034a"></a>uint32_t</td>
<td class="fieldname">
busy: 1</td>
<td class="fielddoc">
Busy flag. </td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="a6b29e4f37f4482274af785ad5ffe96a7"></a>uint32_t</td>
<td class="fieldname">
mode: 1</td>
<td class="fielddoc">
Mode: 0=Slave, 1=Master. </td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="a2148ffb99828aeaced6a5655502434ac"></a>uint32_t</td>
<td class="fieldname">
direction: 1</td>
<td class="fielddoc">
Direction: 0=Transmitter, 1=Receiver. </td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="ab65804439f6f5beda8da30381b0ad22d"></a>uint32_t</td>
<td class="fieldname">
general_call: 1</td>
<td class="fielddoc">
General Call indication (cleared on start of next Slave operation) </td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="ab3e3c8eeeae7fbe3c51dcb3d4104af24"></a>uint32_t</td>
<td class="fieldname">
arbitration_lost: 1</td>
<td class="fielddoc">
Master lost arbitration (cleared on start of next Master operation) </td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="a43b1d210c48f4361c5054ba69bcae702"></a>uint32_t</td>
<td class="fieldname">
bus_error: 1</td>
<td class="fielddoc">
Bus error detected (cleared on start of next Master/Slave operation) </td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="aa43c4c21b173ada1b6b7568956f0d650"></a>uint32_t</td>
<td class="fieldname">
reserved: 26</td>
<td class="fielddoc">
</td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Typedef Documentation</h2>
<a class="anchor" id="ga24277c48248a09b0dd7f12bbe22ce13c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ARM_I2C_SignalEvent_t</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Pointer to <a class="el" href="group__i2c__interface__gr.html#gad4f93d2895794b416dc8d8e9de91c05e">ARM_I2C_SignalEvent</a> : Signal I2C Event. </p>
<p>Provides the typedef for the callback function <a class="el" href="group__i2c__interface__gr.html#gad4f93d2895794b416dc8d8e9de91c05e">ARM_I2C_SignalEvent</a>.</p>
<p><b>Parameter for:</b></p>
<ul>
<li><a class="el" href="group__i2c__interface__gr.html#ga79d2f7d01b3a681d1cf0d70ac6692696">ARM_I2C_Initialize</a> </li>
</ul>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga956bd87590c7fb6e23609a0abfb5412c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__common__drv__gr.html#structARM__DRIVER__VERSION">ARM_DRIVER_VERSION</a> ARM_I2C_GetVersion </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get driver version. </p>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__common__drv__gr.html#structARM__DRIVER__VERSION">ARM_DRIVER_VERSION</a></dd></dl>
<p>The function <b>ARM_I2C_GetVersion</b> returns version information of the driver implementation in <a class="el" href="group__common__drv__gr.html#structARM__DRIVER__VERSION">ARM_DRIVER_VERSION</a></p>
<ul>
<li>API version is the version of the CMSIS-Driver specification used to implement this driver.</li>
<li>Driver version is source code version of the actual driver implementation.</li>
</ul>
<p>Example: </p>
<div class="fragment"><div class="line"><span class="keyword">extern</span> <a class="code" href="group__i2c__interface__gr.html#structARM__DRIVER__I2C">ARM_DRIVER_I2C</a> Driver_I2C0;</div>
<div class="line"><a class="code" href="group__i2c__interface__gr.html#structARM__DRIVER__I2C">ARM_DRIVER_I2C</a> *drv_info;</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> setup_i2c (<span class="keywordtype">void</span>)  {</div>
<div class="line">  <a class="code" href="group__common__drv__gr.html#structARM__DRIVER__VERSION">ARM_DRIVER_VERSION</a>  version;</div>
<div class="line"> </div>
<div class="line">  drv_info = &amp;Driver_I2C0;  </div>
<div class="line">  version = drv_info-&gt;<a class="code" href="group__i2c__interface__gr.html#a8834b281da48583845c044a81566c1b3">GetVersion</a> ();</div>
<div class="line">  <span class="keywordflow">if</span> (version.<a class="code" href="group__common__drv__gr.html#ad180da20fbde1d3dafc074af87c19540">api</a> &lt; 0x10A)   {      <span class="comment">// requires at minimum API version 1.10 or higher</span></div>
<div class="line">    <span class="comment">// error handling</span></div>
<div class="line">    <span class="keywordflow">return</span>;</div>
<div class="line">  }</div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="gad20e6731f627aa7b9d6e99a50806122e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__i2c__interface__gr.html#structARM__I2C__CAPABILITIES">ARM_I2C_CAPABILITIES</a> ARM_I2C_GetCapabilities </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get driver capabilities. </p>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__i2c__interface__gr.html#structARM__I2C__CAPABILITIES">ARM_I2C_CAPABILITIES</a></dd></dl>
<p>The function <b>ARM_I2C_GetCapabilities</b> returns information about capabilities of this driver implementation. The data fields of the struct <a class="el" href="group__i2c__interface__gr.html#structARM__I2C__CAPABILITIES">ARM_I2C_CAPABILITIES</a> encodes the driver capabilities.</p>
<p>Example: </p>
<div class="fragment"><div class="line"><span class="keyword">extern</span> <a class="code" href="group__i2c__interface__gr.html#structARM__DRIVER__I2C">ARM_DRIVER_I2C</a> Driver_I2C0;</div>
<div class="line"><a class="code" href="group__i2c__interface__gr.html#structARM__DRIVER__I2C">ARM_DRIVER_I2C</a> *drv_info;</div>
<div class="line">  </div>
<div class="line"><span class="keywordtype">void</span> read_capabilities (<span class="keywordtype">void</span>)  {</div>
<div class="line">  <a class="code" href="group__i2c__interface__gr.html#structARM__I2C__CAPABILITIES">ARM_I2C_CAPABILITIES</a> drv_capabilities;</div>
<div class="line"> </div>
<div class="line">  drv_info = &amp;Driver_I2C0;  </div>
<div class="line">  drv_capabilities = drv_info-&gt;<a class="code" href="group__i2c__interface__gr.html#a5dfa74ca82e0af995d43da61e08c3103">GetCapabilities</a> ();</div>
<div class="line">  <span class="comment">// interrogate capabilities</span></div>
<div class="line"> </div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="ga79d2f7d01b3a681d1cf0d70ac6692696"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_I2C_Initialize </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__i2c__interface__gr.html#ga24277c48248a09b0dd7f12bbe22ce13c">ARM_I2C_SignalEvent_t</a>&#160;</td>
          <td class="paramname"><em>cb_event</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize I2C Interface. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">cb_event</td><td>Pointer to <a class="el" href="group__i2c__interface__gr.html#gad4f93d2895794b416dc8d8e9de91c05e">ARM_I2C_SignalEvent</a> </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__execution__status.html">Status Error Codes</a></dd></dl>
<p>The function <b>ARM_I2C_Initialize</b> initializes the I2C interface. It is called when the middleware component starts operation.</p>
<p>The function performs the following operations:</p>
<ul>
<li>Initializes and the I/O resources for the I2C interface.</li>
<li>Registers the <a class="el" href="group__i2c__interface__gr.html#gad4f93d2895794b416dc8d8e9de91c05e">ARM_I2C_SignalEvent</a> callback function.</li>
</ul>
<p>The parameter <em>cb_event</em> is a pointer to the <a class="el" href="group__i2c__interface__gr.html#gad4f93d2895794b416dc8d8e9de91c05e">ARM_I2C_SignalEvent</a> callback function. Use a NULL pointer when no callback events are required.</p>
<p>Can be called multiple times. If the peripheral is already initialized the function performs no operation and returns with <a class="el" href="group__execution__status.html#ga85752c5de59e8adeb001e35ff5be6be7">ARM_DRIVER_OK</a>. Refer to <a class="el" href="theoryOperation.html#CallSequence">Function Call Sequence</a> for more information.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="group__i2c__interface__gr.html#ga734a69200e063fdbfb5110062afe9329" title="Control I2C Interface Power. ">ARM_I2C_PowerControl</a> </dd>
<dd>
<a class="el" href="group__i2c__interface__gr.html#ga30d8bf600b6b3182a1f867407b3d6e75" title="De-initialize I2C Interface. ">ARM_I2C_Uninitialize</a></dd></dl>
<p><b>Example:</b> </p>
<ul>
<li>refer to <a class="el" href="group__nand__interface__gr.html#example">Example Code</a> </li>
</ul>

</div>
</div>
<a class="anchor" id="ga30d8bf600b6b3182a1f867407b3d6e75"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_I2C_Uninitialize </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>De-initialize I2C Interface. </p>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__execution__status.html">Status Error Codes</a></dd></dl>
<p>The function <b>ARM_I2C_Uninitialize</b> releases the I/O resources of I2C interface.</p>
<p>It is called when the middleware component stops operation and releases the I/O resources used by the I2C interface. Refer to <a class="el" href="theoryOperation.html#CallSequence">Function Call Sequence</a> for more information.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="group__i2c__interface__gr.html#ga79d2f7d01b3a681d1cf0d70ac6692696" title="Initialize I2C Interface. ">ARM_I2C_Initialize</a> </dd>
<dd>
<a class="el" href="group__i2c__interface__gr.html#ga734a69200e063fdbfb5110062afe9329" title="Control I2C Interface Power. ">ARM_I2C_PowerControl</a> </dd></dl>

</div>
</div>
<a class="anchor" id="ga734a69200e063fdbfb5110062afe9329"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_I2C_PowerControl </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__common__drv__gr.html#ga47d6d7c31f88f3b8ae4aaf9d8444afa5">ARM_POWER_STATE</a>&#160;</td>
          <td class="paramname"><em>state</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Control I2C Interface Power. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">state</td><td>Power state </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__execution__status.html">Status Error Codes</a></dd></dl>
<p>The function <b>ARM_I2C_PowerControl</b> operates the power modes of the I2C interface.</p>
<p>The parameter <em>state</em> can have the following values:</p>
<ul>
<li><a class="el" href="Driver__Common_8h.html#ga47d6d7c31f88f3b8ae4aaf9d8444afa5abed52b77a9ce4775570e44a842b1295e">ARM_POWER_FULL</a> : set-up peripheral for data transfers, enable interrupts (NVIC) and optionally DMA. Can be called multiple times. If the peripheral is already in this mode, then the function performs no operation and returns with <a class="el" href="group__execution__status.html#ga85752c5de59e8adeb001e35ff5be6be7">ARM_DRIVER_OK</a>.</li>
<li><a class="el" href="Driver__Common_8h.html#ga47d6d7c31f88f3b8ae4aaf9d8444afa5a9ef9e57cbcc948d0e22314e73dc8c434">ARM_POWER_LOW</a> : may use power saving. Returns <a class="el" href="group__execution__status.html#ga2efa59e480d82697795439220e6884e4">ARM_DRIVER_ERROR_UNSUPPORTED</a> when not implemented.</li>
<li><a class="el" href="Driver__Common_8h.html#ga47d6d7c31f88f3b8ae4aaf9d8444afa5ab6f5becc85ebd51c3dd2524a95d2ca35">ARM_POWER_OFF</a> : terminates any pending data transfers, disables peripheral, disables related interrupts and DMA.</li>
</ul>
<p>Refer to <a class="el" href="theoryOperation.html#CallSequence">Function Call Sequence</a> for more information.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="group__i2c__interface__gr.html#ga79d2f7d01b3a681d1cf0d70ac6692696" title="Initialize I2C Interface. ">ARM_I2C_Initialize</a> </dd>
<dd>
<a class="el" href="group__i2c__interface__gr.html#ga30d8bf600b6b3182a1f867407b3d6e75" title="De-initialize I2C Interface. ">ARM_I2C_Uninitialize</a> </dd></dl>

</div>
</div>
<a class="anchor" id="ga8bf4214580149d5a5d2360f71f0feb94"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_I2C_MasterTransmit </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>addr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>num</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>xfer_pending</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Start transmitting data as I2C Master. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">addr</td><td>Slave address (7-bit or 10-bit) </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">data</td><td>Pointer to buffer with data to transmit to I2C Slave </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">num</td><td>Number of data bytes to transmit </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">xfer_pending</td><td>Transfer operation is pending - Stop condition will not be generated </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__execution__status.html">Status Error Codes</a></dd></dl>
<p>This function <b>ARM_I2C_MasterTransmit</b> transmits data as Master to the selected Slave.</p>
<p>The operation consists of:</p>
<ul>
<li>Master generates START condition</li>
<li>Master addresses the Slave as Master Transmitter</li>
<li>Master transmits data to the addressed Slave</li>
<li>Master generates STOP condition (if <em>xfer_pending</em> is "false")</li>
</ul>
<p>The parameter <em>addr</em> is the address of the slave to transmit the data to. The value can be ORed with <a class="el" href="group__i2c__address__flags.html#ga16be1861b90774bf062feab2dbb829a4">ARM_I2C_ADDRESS_10BIT</a> to identify a 10-bit address value. <br/>
The parameter <em>data</em> and <em>num</em> specify the address of a data buffer and the number of bytes to transmit. <br/>
Set the parameter <em>xfer_pending</em> to 'true' if another transfer operation follows. With <em>xfer_pending</em> set to 'false' a STOP condition is generated.</p>
<p>The function is non-blocking and returns as soon as the driver has started the operation. During the operation it is not allowed to call any Master function again. Also the data buffer must stay allocated and the contents of data must not be modified. When transmit operation has finished the <a class="el" href="group__I2C__events.html#ga5992dc0f6e839c4d066cfa83d535f30d">ARM_I2C_EVENT_TRANSFER_DONE</a> event is generated. When not all the data is transferred then the <a class="el" href="group__I2C__events.html#gafac3989c7b57727e1bed4ee9f2496ac9">ARM_I2C_EVENT_TRANSFER_INCOMPLETE</a> flag is set at the same time.</p>
<p>Number of data bytes transmitted and acknowledged is returned by the function <a class="el" href="group__i2c__interface__gr.html#ga19db20ad8d7fde84d07f6db4d75f4b7c">ARM_I2C_GetDataCount</a> during and after the operation has finished.</p>
<p>The operation is aborted in the following cases (<a class="el" href="group__I2C__events.html#ga5992dc0f6e839c4d066cfa83d535f30d">ARM_I2C_EVENT_TRANSFER_DONE</a> event is generated together with):</p>
<ul>
<li>selected slave has not acknowledged the address: <a class="el" href="group__I2C__events.html#ga98b815769634d9578526b43589caa017">ARM_I2C_EVENT_ADDRESS_NACK</a> event</li>
<li>arbitration has been lost: <a class="el" href="group__I2C__events.html#gac9000f44a578e2117d64dbc2093cec6d">ARM_I2C_EVENT_ARBITRATION_LOST</a> event</li>
<li>bus error has been detected: <a class="el" href="group__I2C__events.html#gaeef542840355131c18b53fd9ed1904a8">ARM_I2C_EVENT_BUS_ERROR</a> event</li>
</ul>
<p>Status can be monitored by calling the <a class="el" href="group__i2c__interface__gr.html#gaba4e0f3eb4018e7dafd51b675c465f3e">ARM_I2C_GetStatus</a> and checking the flags.</p>
<p>Transmit operation can be aborted also by calling <a class="el" href="group__i2c__interface__gr.html#ga828f5fa289d065675ef78a9a73d129dc">ARM_I2C_Control</a> with the parameter <em>control</em> <a class="el" href="group__i2c__control__codes.html#ga661e91aaa642d10ba80e3cc72f263040">ARM_I2C_ABORT_TRANSFER</a>. </p>

</div>
</div>
<a class="anchor" id="gafa22504bcf88a85584dfe6e0dd270ad5"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_I2C_MasterReceive </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>addr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>num</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>xfer_pending</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Start receiving data as I2C Master. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">addr</td><td>Slave address (7-bit or 10-bit) </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">data</td><td>Pointer to buffer for data to receive from I2C Slave </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">num</td><td>Number of data bytes to receive </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">xfer_pending</td><td>Transfer operation is pending - Stop condition will not be generated </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__execution__status.html">Status Error Codes</a></dd></dl>
<p>This function <b>ARM_I2C_MasterReceive</b> is used to receive data as Master from the selected Slave.</p>
<p>The operation consists of:</p>
<ul>
<li>Master generates START condition</li>
<li>Master addresses the Slave as Master Receiver</li>
<li>Master receives data from the addressed Slave</li>
<li>Master generates STOP condition (if <em>xfer_pending</em> is "false")</li>
</ul>
<p>The parameter <em>addr</em> is the address of the slave to receive the data from. The value can be ORed with <a class="el" href="group__i2c__address__flags.html#ga16be1861b90774bf062feab2dbb829a4">ARM_I2C_ADDRESS_10BIT</a> to identify a 10-bit address value. <br/>
The parameter <em>data</em> and <em>num</em> specify the address of a data buffer and the number of bytes to receive. <br/>
Set the parameter <em>xfer_pending</em> to 'true' if another transfer operation follows. With <em>xfer_pending</em> set to 'false' a STOP condition is generated.</p>
<p>The function is non-blocking and returns as soon as the driver has started the operation. During the operation it is not allowed to call any Master function again. Also the data buffer must stay allocated. When receive operation has finished the <a class="el" href="group__I2C__events.html#ga5992dc0f6e839c4d066cfa83d535f30d">ARM_I2C_EVENT_TRANSFER_DONE</a> event is generated. When not all the data is transferred then the <a class="el" href="group__I2C__events.html#gafac3989c7b57727e1bed4ee9f2496ac9">ARM_I2C_EVENT_TRANSFER_INCOMPLETE</a> flag is set at the same time.</p>
<p>Number of data bytes received is returned by the function <a class="el" href="group__i2c__interface__gr.html#ga19db20ad8d7fde84d07f6db4d75f4b7c">ARM_I2C_GetDataCount</a> during and after the operation has finished.</p>
<p>The operation is aborted in the following cases (<a class="el" href="group__I2C__events.html#ga5992dc0f6e839c4d066cfa83d535f30d">ARM_I2C_EVENT_TRANSFER_DONE</a> event is generated together with):</p>
<ul>
<li>selected slave has not acknowledged the address: <a class="el" href="group__I2C__events.html#ga98b815769634d9578526b43589caa017">ARM_I2C_EVENT_ADDRESS_NACK</a> event</li>
<li>arbitration has been lost: <a class="el" href="group__I2C__events.html#gac9000f44a578e2117d64dbc2093cec6d">ARM_I2C_EVENT_ARBITRATION_LOST</a> event</li>
<li>bus error has been detected: <a class="el" href="group__I2C__events.html#gaeef542840355131c18b53fd9ed1904a8">ARM_I2C_EVENT_BUS_ERROR</a> event</li>
</ul>
<p>Status can be monitored by calling the <a class="el" href="group__i2c__interface__gr.html#gaba4e0f3eb4018e7dafd51b675c465f3e">ARM_I2C_GetStatus</a> and checking the flags.</p>
<p>Receive operation can be aborted also by calling <a class="el" href="group__i2c__interface__gr.html#ga828f5fa289d065675ef78a9a73d129dc">ARM_I2C_Control</a> with the parameter <em>control</em> = <a class="el" href="group__i2c__control__codes.html#ga661e91aaa642d10ba80e3cc72f263040">ARM_I2C_ABORT_TRANSFER</a>. </p>

</div>
</div>
<a class="anchor" id="gafe164f30eba78f066272373b98a62cd4"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_I2C_SlaveTransmit </td>
          <td>(</td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>num</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Start transmitting data as I2C Slave. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">data</td><td>Pointer to buffer with data to transmit to I2C Master </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">num</td><td>Number of data bytes to transmit </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__execution__status.html">Status Error Codes</a></dd></dl>
<p>This function <b>ARM_I2C_SlaveTransmit</b> is used to transmit data as Slave to the Master.</p>
<p>The parameter <em>data</em> is a pointer to the data to transmit. <br/>
The parameter <em>num</em> specifies the number of bytes to transmit.</p>
<p>The function is non-blocking and returns as soon as the driver has registered the operation. The actual operation will start after being addressed by the master as a Slave Transmitter. If the operation has not been registered at that point the <a class="el" href="group__I2C__events.html#gacfbbec9af083d35e8ea87ad16e9c6ec2">ARM_I2C_EVENT_SLAVE_TRANSMIT</a> event is generated. The same event is also generated if the operation has finished (specified number of bytes transmitted) but more data is requested by the master.</p>
<p>It is not allowed to call this function again if the operation has started until it finishes. Also the data buffer must stay allocated and the contents of data must not be modified. When transmit operation has finished the <a class="el" href="group__I2C__events.html#ga5992dc0f6e839c4d066cfa83d535f30d">ARM_I2C_EVENT_TRANSFER_DONE</a> event is generated. When not all the data is transferred then the <a class="el" href="group__I2C__events.html#gafac3989c7b57727e1bed4ee9f2496ac9">ARM_I2C_EVENT_TRANSFER_INCOMPLETE</a> flag is set at the same time.</p>
<p>Number of data bytes transmitted is returned by the function <a class="el" href="group__i2c__interface__gr.html#ga19db20ad8d7fde84d07f6db4d75f4b7c">ARM_I2C_GetDataCount</a> during and after the operation has finished.</p>
<p>In case that a General call has been detected the <a class="el" href="group__I2C__events.html#ga3ab54410b6410ed3a58762ff0c0d68b9">ARM_I2C_EVENT_GENERAL_CALL</a> flag is indicated together with the <a class="el" href="group__I2C__events.html#ga5992dc0f6e839c4d066cfa83d535f30d">ARM_I2C_EVENT_TRANSFER_DONE</a> event (also with <a class="el" href="group__I2C__events.html#gacfbbec9af083d35e8ea87ad16e9c6ec2">ARM_I2C_EVENT_SLAVE_TRANSMIT</a> event).</p>
<p>In case that bus error has been detected then the operation is aborted and the <a class="el" href="group__I2C__events.html#gaeef542840355131c18b53fd9ed1904a8">ARM_I2C_EVENT_BUS_ERROR</a> event is generated together with <a class="el" href="group__I2C__events.html#ga5992dc0f6e839c4d066cfa83d535f30d">ARM_I2C_EVENT_TRANSFER_DONE</a>.</p>
<p>Slave will only respond to its own address (or General call if enabled) that is specified by calling <a class="el" href="group__i2c__interface__gr.html#ga828f5fa289d065675ef78a9a73d129dc">ARM_I2C_Control</a> with <a class="el" href="group__i2c__control__codes.html#ga69d130b9f8aa34d6df5334ab67c74307">ARM_I2C_OWN_ADDRESS</a> as control parameter. Using address <span class="XML-Token">0</span> disables the slave.</p>
<p>Status can be monitored by calling the <a class="el" href="group__i2c__interface__gr.html#gaba4e0f3eb4018e7dafd51b675c465f3e">ARM_I2C_GetStatus</a> and checking the flags.</p>
<p>Transmit operation can be canceled or aborted by calling <a class="el" href="group__i2c__interface__gr.html#ga828f5fa289d065675ef78a9a73d129dc">ARM_I2C_Control</a> with the parameter <em>control</em> = <a class="el" href="group__i2c__control__codes.html#ga661e91aaa642d10ba80e3cc72f263040">ARM_I2C_ABORT_TRANSFER</a>. </p>

</div>
</div>
<a class="anchor" id="gae3c9abccd1d377385d3d4cfe29035164"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_I2C_SlaveReceive </td>
          <td>(</td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>num</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Start receiving data as I2C Slave. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">data</td><td>Pointer to buffer for data to receive from I2C Master </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">num</td><td>Number of data bytes to receive </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__execution__status.html">Status Error Codes</a></dd></dl>
<p>This function <b>ARM_I2C_SlaveReceive</b> receives data as Slave from the Master.</p>
<p>The parameter <em>data</em> is a pointer to the data to receive. <br/>
The parameter <em>num</em> specifies the number of bytes to receive.</p>
<p>The function is non-blocking and returns as soon as the driver has registered the operation. The actual operation will start after being addressed by the master as a Slave Receiver. If the operation has not been registered at that point the <a class="el" href="group__I2C__events.html#gabd875b57ce39dadd849c53b885ad6661">ARM_I2C_EVENT_SLAVE_RECEIVE</a> event is generated.</p>
<p>It is not allowed to call this function again if the operation has started until it finishes. Also the data buffer must stay allocated. When receive operation has finished the <a class="el" href="group__I2C__events.html#ga5992dc0f6e839c4d066cfa83d535f30d">ARM_I2C_EVENT_TRANSFER_DONE</a> event is generated. When not all the data is transferred then the <a class="el" href="group__I2C__events.html#gafac3989c7b57727e1bed4ee9f2496ac9">ARM_I2C_EVENT_TRANSFER_INCOMPLETE</a> flag is set at the same time.</p>
<p>Number of data bytes received and acknowledged is returned by the function <a class="el" href="group__i2c__interface__gr.html#ga19db20ad8d7fde84d07f6db4d75f4b7c">ARM_I2C_GetDataCount</a> during and after the operation has finished.</p>
<p>In case that a General call has been detected the <a class="el" href="group__I2C__events.html#ga3ab54410b6410ed3a58762ff0c0d68b9">ARM_I2C_EVENT_GENERAL_CALL</a> flag is indicated together with the <a class="el" href="group__I2C__events.html#ga5992dc0f6e839c4d066cfa83d535f30d">ARM_I2C_EVENT_TRANSFER_DONE</a> event (also with <a class="el" href="group__I2C__events.html#gabd875b57ce39dadd849c53b885ad6661">ARM_I2C_EVENT_SLAVE_RECEIVE</a> event).</p>
<p>In case that bus error has been detected then the operation is aborted and the <a class="el" href="group__I2C__events.html#gaeef542840355131c18b53fd9ed1904a8">ARM_I2C_EVENT_BUS_ERROR</a> event is generated together with <a class="el" href="group__I2C__events.html#ga5992dc0f6e839c4d066cfa83d535f30d">ARM_I2C_EVENT_TRANSFER_DONE</a>.</p>
<p>Slave will only respond to its own address (or General call if enabled) that is specified by calling <a class="el" href="group__i2c__interface__gr.html#ga828f5fa289d065675ef78a9a73d129dc">ARM_I2C_Control</a> with <a class="el" href="group__i2c__control__codes.html#ga69d130b9f8aa34d6df5334ab67c74307">ARM_I2C_OWN_ADDRESS</a> as control parameter. Using address <span class="XML-Token">0</span> disables the slave.</p>
<p>Status can be monitored by calling the <a class="el" href="group__i2c__interface__gr.html#gaba4e0f3eb4018e7dafd51b675c465f3e">ARM_I2C_GetStatus</a> and checking the flags.</p>
<p>Receive operation can be canceled or aborted by calling <a class="el" href="group__i2c__interface__gr.html#ga828f5fa289d065675ef78a9a73d129dc">ARM_I2C_Control</a> with the parameter <em>control</em> = <a class="el" href="group__i2c__control__codes.html#ga661e91aaa642d10ba80e3cc72f263040">ARM_I2C_ABORT_TRANSFER</a>. </p>

</div>
</div>
<a class="anchor" id="ga19db20ad8d7fde84d07f6db4d75f4b7c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_I2C_GetDataCount </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get transferred data count. </p>
<dl class="section return"><dt>Returns</dt><dd>number of data bytes transferred; -1 when Slave is not addressed by Master</dd></dl>
<p>The function <b>ARM_I2C_GetDataCount</b> returns the number of currently transferred data bytes during and after:</p>
<ul>
<li><a class="el" href="group__i2c__interface__gr.html#ga8bf4214580149d5a5d2360f71f0feb94">ARM_I2C_MasterTransmit</a> : number of data bytes transmitted and acknowledged</li>
<li><a class="el" href="group__i2c__interface__gr.html#gafa22504bcf88a85584dfe6e0dd270ad5">ARM_I2C_MasterReceive</a> : number of data bytes received</li>
<li><a class="el" href="group__i2c__interface__gr.html#gafe164f30eba78f066272373b98a62cd4">ARM_I2C_SlaveTransmit</a> : number of data bytes transmitted</li>
<li><a class="el" href="group__i2c__interface__gr.html#gae3c9abccd1d377385d3d4cfe29035164">ARM_I2C_SlaveReceive</a> : number of data bytes received and acknowledged</li>
</ul>
<p>When the Slave is not yet addressed by the Master then <span class="XML-Token">-1</span> is returned. </p>

</div>
</div>
<a class="anchor" id="ga828f5fa289d065675ef78a9a73d129dc"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_I2C_Control </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>control</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>arg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Control I2C Interface. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">control</td><td>Operation </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">arg</td><td>Argument of operation (optional) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__execution__status.html">Status Error Codes</a></dd></dl>
<p>The function <b>ARM_I2C_Control</b> operates the I2C interface and executes various operations.</p>
<p>The parameter <em>control</em> specifies various operations as listed in the table below. <br/>
The parameter <em>arg</em> provides, depending on the operation, additional information. <br/>
 </p>
<table class="doxtable">
<tr>
<th align="left">Parameter <em>control</em> </th><th align="left">Operation  </th></tr>
<tr>
<td align="left"><a class="el" href="group__i2c__control__codes.html#ga69d130b9f8aa34d6df5334ab67c74307">ARM_I2C_OWN_ADDRESS</a> </td><td align="left">Set Own Slave Address; <em>arg</em> = slave address </td></tr>
<tr>
<td align="left"><a class="el" href="group__i2c__control__codes.html#ga35733133237d65146abd9449f5353a7f">ARM_I2C_BUS_SPEED</a> </td><td align="left">Set Bus Speed; <em>arg</em> = bus speed </td></tr>
<tr>
<td align="left"><a class="el" href="group__i2c__control__codes.html#gadacf04578770faca4b3eaae34b2c5f03">ARM_I2C_BUS_CLEAR</a> </td><td align="left">Clear the bus by sending nine clock pulses </td></tr>
<tr>
<td align="left"><a class="el" href="group__i2c__control__codes.html#ga661e91aaa642d10ba80e3cc72f263040">ARM_I2C_ABORT_TRANSFER</a> </td><td align="left">Aborts the data transfer between Master and Slave for Transmit or Receive </td></tr>
</table>
<p><b>Set Own Slave Address</b></p>
<p>After initialization, the I2C Device has no slave address assigned and does not accept any requests from an I2C Master.</p>
<p>The <em>control</em> operation <a class="el" href="group__i2c__control__codes.html#ga69d130b9f8aa34d6df5334ab67c74307">ARM_I2C_OWN_ADDRESS</a> sets the slave address with the parameter <em>arg</em>. The slave address can be ORed with <a class="el" href="group__i2c__address__flags.html#ga16be1861b90774bf062feab2dbb829a4">ARM_I2C_ADDRESS_10BIT</a> to indicate a 10-bit address.</p>
<p>The slave address can be ORed with <a class="el" href="group__i2c__address__flags.html#ga337f4f1aa082e9b593b2dcd43c50134e">ARM_I2C_ADDRESS_GC</a> to indicate that the slave accepts a General Call. If the slave address value is only <a class="el" href="group__i2c__address__flags.html#ga337f4f1aa082e9b593b2dcd43c50134e">ARM_I2C_ADDRESS_GC</a>, then the slave only accepts a General Call.</p>
<p>The slave address value <span class="XML-Token">0</span> disables Slave mode and clears any assigned slave address.</p>
<p>Examples:**</p>
<p>Set the Slave address value <span class="XML-Token">0x45</span> as 7-bit address. </p>
<div class="fragment"><div class="line">I2Cdrv-&gt;<a class="code" href="group__i2c__interface__gr.html#a6e0f47a92f626a971c5197fca6545505">Control</a>      (<a class="code" href="group__i2c__control__codes.html#ga69d130b9f8aa34d6df5334ab67c74307">ARM_I2C_OWN_ADDRESS</a>, 0x45);</div>
</div><!-- fragment --><p>Set the Slave address value <span class="XML-Token">0x135</span> as 10-bit address and accept a General Call. </p>
<div class="fragment"><div class="line">I2Cdrv-&gt;<a class="code" href="group__i2c__interface__gr.html#a6e0f47a92f626a971c5197fca6545505">Control</a>      (<a class="code" href="group__i2c__control__codes.html#ga69d130b9f8aa34d6df5334ab67c74307">ARM_I2C_OWN_ADDRESS</a>, 0x135 | <a class="code" href="group__i2c__address__flags.html#ga16be1861b90774bf062feab2dbb829a4">ARM_I2C_ADDRESS_10BIT</a> | <a class="code" href="group__i2c__address__flags.html#ga337f4f1aa082e9b593b2dcd43c50134e">ARM_I2C_ADDRESS_GC</a>);</div>
</div><!-- fragment --><p><b>Bus Speed</b></p>
<p>The <em>control</em> operation <a class="el" href="group__i2c__control__codes.html#ga35733133237d65146abd9449f5353a7f">ARM_I2C_BUS_SPEED</a> sets the bus speed using the parameter <em>arg</em>.</p>
<table class="doxtable">
<tr>
<th align="left">Parameter <em>arg</em> </th><th align="left">Bus Speed  </th></tr>
<tr>
<td align="left"><a class="el" href="group__i2c__bus__speed__ctrls.html#ga0aaa6398280fdd7ad651d7d6d44c863f">ARM_I2C_BUS_SPEED_STANDARD</a> </td><td align="left">Standard Speed to (<span class="XML-Token">100 kHz</span>) </td></tr>
<tr>
<td align="left"><a class="el" href="group__i2c__bus__speed__ctrls.html#ga39f49ef4cd1100a8d9dc9003329e5ecd">ARM_I2C_BUS_SPEED_FAST</a> </td><td align="left">Fast Speed (<span class="XML-Token">400kHz</span>) </td></tr>
<tr>
<td align="left"><a class="el" href="group__i2c__bus__speed__ctrls.html#ga2615262062e0327ab478ec85675ca649">ARM_I2C_BUS_SPEED_FAST_PLUS</a> </td><td align="left">Fast + Speed (<span class="XML-Token">1MHz</span>) </td></tr>
<tr>
<td align="left"><a class="el" href="group__i2c__bus__speed__ctrls.html#ga10aae5a8c7fcc90e514c5fb7393056ec">ARM_I2C_BUS_SPEED_HIGH</a> </td><td align="left">High Speed (<span class="XML-Token">3.4MHz</span>) </td></tr>
</table>
<p>Example:**</p>
<div class="fragment"><div class="line">I2Cdrv-&gt;<a class="code" href="group__i2c__interface__gr.html#a6e0f47a92f626a971c5197fca6545505">Control</a>      (<a class="code" href="group__i2c__control__codes.html#ga35733133237d65146abd9449f5353a7f">ARM_I2C_BUS_SPEED</a>, I2C_BUS_SPEED_FAST);</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="gaba4e0f3eb4018e7dafd51b675c465f3e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__i2c__interface__gr.html#structARM__I2C__STATUS">ARM_I2C_STATUS</a> ARM_I2C_GetStatus </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get I2C status. </p>
<dl class="section return"><dt>Returns</dt><dd>I2C status <a class="el" href="group__i2c__interface__gr.html#structARM__I2C__STATUS">ARM_I2C_STATUS</a></dd></dl>
<p>The function <b>ARM_I2C_GetStatus</b> returns the current I2C interface status.</p>
<p>Refer to <a class="el" href="group__i2c__interface__gr.html#structARM__I2C__STATUS">ARM_I2C_STATUS</a> for details. </p>

</div>
</div>
<a class="anchor" id="gad4f93d2895794b416dc8d8e9de91c05e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ARM_I2C_SignalEvent </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>event</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Signal I2C Events. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">event</td><td><a class="el" href="group__I2C__events.html">I2C Events</a> notification mask</td></tr>
  </table>
  </dd>
</dl>
<p>The function <b>ARM_I2C_SignalEvent</b> is a callback function registered by the function <a class="el" href="group__i2c__interface__gr.html#ga79d2f7d01b3a681d1cf0d70ac6692696">ARM_I2C_Initialize</a>.. It is called by the I2C driver to notify the application about <a class="el" href="group__I2C__events.html">I2C Events</a> occured during operation.</p>
<p>The parameter <em>event</em> indicates one or more events that occurred during driver operation. Each event is encoded in a separate bit and therefore it is possible to signal multiple events within the same call.</p>
<p>The following events can be generated:</p>
<table class="doxtable">
<tr>
<th align="left">Parameter <em>event</em> </th><th align="center">Bit </th><th align="left">Description  </th></tr>
<tr>
<td align="left"><a class="el" href="group__I2C__events.html#ga5992dc0f6e839c4d066cfa83d535f30d">ARM_I2C_EVENT_TRANSFER_DONE</a> </td><td align="center">1UL&#160;&lt;&lt;&#160;0 </td><td align="left">Occurs after Master/Slave Transmit/Receive operation has finished. </td></tr>
<tr>
<td align="left"><a class="el" href="group__I2C__events.html#gafac3989c7b57727e1bed4ee9f2496ac9">ARM_I2C_EVENT_TRANSFER_INCOMPLETE</a> </td><td align="center">1UL &lt;&lt; 1 </td><td align="left">Occurs together with <a class="el" href="group__I2C__events.html#ga5992dc0f6e839c4d066cfa83d535f30d">ARM_I2C_EVENT_TRANSFER_DONE</a> when less data is transferred then requested. </td></tr>
<tr>
<td align="left"><a class="el" href="group__I2C__events.html#gacfbbec9af083d35e8ea87ad16e9c6ec2">ARM_I2C_EVENT_SLAVE_TRANSMIT</a> </td><td align="center">1UL &lt;&lt; 2 </td><td align="left">Occurs when addressed as Slave Transmitter and <a class="el" href="group__i2c__interface__gr.html#gafe164f30eba78f066272373b98a62cd4">ARM_I2C_SlaveTransmit</a> has not been started. </td></tr>
<tr>
<td align="left"><a class="el" href="group__I2C__events.html#gabd875b57ce39dadd849c53b885ad6661">ARM_I2C_EVENT_SLAVE_RECEIVE</a> </td><td align="center">1UL &lt;&lt; 3 </td><td align="left">Occurs when addressed as Slave Receiver and <a class="el" href="group__i2c__interface__gr.html#gae3c9abccd1d377385d3d4cfe29035164">ARM_I2C_SlaveReceive</a> has not been started. </td></tr>
<tr>
<td align="left"><a class="el" href="group__I2C__events.html#ga98b815769634d9578526b43589caa017">ARM_I2C_EVENT_ADDRESS_NACK</a> </td><td align="center">1UL &lt;&lt; 4 </td><td align="left">Occurs in master mode when address is not acknowledged from slave. </td></tr>
<tr>
<td align="left"><a class="el" href="group__I2C__events.html#ga3ab54410b6410ed3a58762ff0c0d68b9">ARM_I2C_EVENT_GENERAL_CALL</a> </td><td align="center">1UL &lt;&lt; 5 </td><td align="left">Indicates General Call in slave mode together with <a class="el" href="group__I2C__events.html#ga5992dc0f6e839c4d066cfa83d535f30d">ARM_I2C_EVENT_TRANSFER_DONE</a>, <a class="el" href="group__I2C__events.html#gacfbbec9af083d35e8ea87ad16e9c6ec2">ARM_I2C_EVENT_SLAVE_TRANSMIT</a> and <a class="el" href="group__I2C__events.html#gabd875b57ce39dadd849c53b885ad6661">ARM_I2C_EVENT_SLAVE_RECEIVE</a>. </td></tr>
<tr>
<td align="left"><a class="el" href="group__I2C__events.html#gac9000f44a578e2117d64dbc2093cec6d">ARM_I2C_EVENT_ARBITRATION_LOST</a> </td><td align="center">1UL &lt;&lt; 6 </td><td align="left">Occurs in master mode when arbitration is lost. </td></tr>
<tr>
<td align="left"><a class="el" href="group__I2C__events.html#gaeef542840355131c18b53fd9ed1904a8">ARM_I2C_EVENT_BUS_ERROR</a> </td><td align="center">1UL &lt;&lt; 7 </td><td align="left">Occurs when bus error is detected. </td></tr>
<tr>
<td align="left"><a class="el" href="group__I2C__events.html#ga81ca21fad73dac1ffaff58921f848ea9">ARM_I2C_EVENT_BUS_CLEAR</a> </td><td align="center">1UL &lt;&lt; 8 </td><td align="left">Occurs after <a class="el" href="group__i2c__control__codes.html#gadacf04578770faca4b3eaae34b2c5f03">ARM_I2C_BUS_CLEAR</a> Control operation has finished. </td></tr>
</table>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Wed Jul 10 2019 15:20:31 for CMSIS-Driver Version 2.7.1 by Arm Ltd. All rights reserved.
	<!--
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 
	-->
	</li>
  </ul>
</div>
</body>
</html>
